package com.app.ytong.bean;


import com.alibaba.fastjson.annotation.JSONField;

import java.util.ArrayList;

public class TraderListBean extends BaseListBean {


    private ArrayList<TraderListData> list = new ArrayList<TraderListData>();

    public ArrayList<TraderListData> getList() {
        return list;
    }

    public void setList(ArrayList<TraderListData> list) {
        this.list = list;
    }

    @JSONField(serialize = false)
    public void addListBean(TraderListBean listbean) {
        if (listbean == null)
            return;
        if (this.getCurrentPage() == INIT_PAGE) {
            setList(listbean.getList());
        } else {
            if (list == null)
                list = new ArrayList<TraderListData>();
            list.addAll(listbean.getList());
        }
        setListBeanData(listbean);
    }

    @JSONField(serialize = false)
    public TraderListData getUser(){
        if(getList().size()>0 || getList()!= null){
            return getList().get(0);
        }else {
            return null;
        }
    }

    @JSONField(serialize = false)
    public boolean isTraderByCardNo(String no){
        boolean isTrader = false;
        for (TraderListData data : list){
            if(data.getCdno().equals(no)){
                isTrader = true;
                break;
            }
        }
        return isTrader;
    }


    @JSONField(serialize = false)
    public TraderListData getTraderByNo(String no){
        for (TraderListData data : list){
            if(data.getCdno().equals(no)){
                return data;
            }
        }
        return null;
    }





}
